<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/wx/page/session.jsp"%>
<c:set var="userId" value="${param.userId}" />
<c:set var="deptId" value="${param.deptId}" />
<c:set var="deptCode" value="${param.deptCode}" />
<c:set var="deptParentId" value="${param.deptParentId}" />
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <title>首页</title>
    <link rel="stylesheet" href="${ctx}/wx/css/default.css"/>
    <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/UserService.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/TruckService.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/interface/BillService.js"></script>
    <script type="text/javascript" src="${ctx}/wx/js/alert.js"></script>
</head>
<body style="text-align: center;">
    <table width="100%" style="font-size: 25px; font-weight: bold; border: 1px solid #C9C9C9">
        <tr>
            <td></td>
            <td>今日</td>
            <td>全部</td>
        </tr>
        <tr>
            <td>车辆总数</td>
            <td id="truckNumToday"></td>
            <td id="truckNum"></td>
        </tr>
        <tr>
            <td>货主总数</td>
            <td id="senderNumToday"></td>
            <td id="senderNum"></td>
        </tr>
        <tr>
            <td>提货单数</td>
            <td id="billNumToday"></td>
            <td id="billNum"></td>
        </tr>
    </table>
    <form>
        <fieldset class="contact-inner">
            <p class="contact-submit">
                <input type="button" value="通讯录" style="width: 49%" onclick="location='${ctx}/wx/page/user_list.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}'">
                <input type="button" value="任务管理" style="width: 49%" onclick="location='${ctx}/wx/page/task_list.jsp?userId=${userId}&deptId=${deptId}&deptCode=${deptCode}&deptParentId=${deptParentId}'">
            </p>
        </fieldset>
    </form>
</body>
</html>
<script type="text/javascript">
    var currentDate = new Date(new Date().Format("yyyy/MM/dd"));

    var truck = new Truck();
    TruckService.selectTruckNum(truck, "${deptParentId}", function (num) {
        dwr.util.setValue("truckNum", num);
    })

    truck.truckCreateTime = currentDate;
    TruckService.selectTruckNum(truck, "${deptParentId}", function (num) {
        dwr.util.setValue("truckNumToday", num);
    })

    var sender = new Sender();
    sender.deptParentId = "${deptParentId}";
    UserService.selectSenderNum(sender, function (num) {
        dwr.util.setValue("senderNum", num);
    })

    var user = new User();
    user.userCreateTime = currentDate;
    sender.user = user;
    UserService.selectSenderNum(sender, function (num) {
        dwr.util.setValue("senderNumToday", num);
    })

    var bill = new Bill();
    bill.deptId = "${deptId}";
    BillService.selectBillNum(bill, function (num) {
        dwr.util.setValue("billNum", num);

    })

    bill.billCreateTime = currentDate;
    BillService.selectBillNum(bill, function (num) {
        dwr.util.setValue("billNumToday", num);
    })
</script>